package com.controller;


import com.DTO.ChatRecordDTO;
import com.Result.ChatRecordResult;
import com.service.ChatRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author XTC
 * @since 2024-07-10
 */
@RestController
@RequestMapping("/chatRecord")
@CrossOrigin
@Api(tags = "聊天记录管理器")
public class ChatRecordController {
    @Autowired
    private ChatRecordService chatRecordService;

    @PostMapping("/getRecordListWithUser")
    @ApiOperation(value = "获取与其他用户的聊天记录", notes="userId1与userId2可互换.\n本方法只用于查询所有聊天记录，不具备条件查询功能")
    public List<ChatRecordResult> getRecordListWithUser(@RequestBody ChatRecordDTO chatRecordDTO) {
        return this.chatRecordService.getRecordListWithUser(chatRecordDTO);
    }

    @PostMapping("/getRecordListWithGroup")
    @ApiOperation(value="获取群聊的聊天记录", notes="userId2为群聊的id,userId1无用,可不填。\n本方法只用于查询所有聊天记录，不具备条件查询功能")
    public List<ChatRecordResult> getRecordListWithGroup(@RequestBody ChatRecordDTO chatRecordDTO) {
        return this.chatRecordService.getRecordListWithGroup(chatRecordDTO);
    }

}

